// pages/match/creator.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    scrollViewHeight: 0,
    starroot: "/images/star",
    creatorName: "in_the_wind",
    creatorStar: 2,
    contractTime: "3",
    historicalEvaluation: "4",
    works: [{
        imgUrl: '/images/1.jpg',
        title: '西子河畔'
      },
      {
        imgUrl: '/images/2.jpg',
        title: '与她携手那些年'
      },
      {
        imgUrl: '/images/3.jpg',
        title: '老杨的故事'
      },
      {
        imgUrl: '/images/5.jpg',
        title: '红旗正当空'
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    let query = wx.createSelectorQuery().in(that);
    // 取出navbar的节点信息
    // 选择器的语法与jQuery语法相同
    query.select('.top').boundingClientRect();
    query.exec(res => {
      console.log("res:")
      console.log(res)
      // 分别取出navbar的高度
      let topHeight = res[0].height;
      let windowHeight = wx.getSystemInfoSync().windowHeight
      console.log("windowHeight:" + windowHeight)
      // 然后就是做个减法
      let scrollViewHeight = windowHeight - 48 - topHeight;
      console.log("scrollViewHeight:" + scrollViewHeight)
      // 算出来之后存到data对象里面
      that.setData({
        scrollViewHeight: scrollViewHeight
      });
      console.log("data:")
      console.log(that.data)
    });
  },

  match(e) {
    wx.navigateTo({
      url: "../match/match"
    })
  }

})